package com.example.guetdemo.domain.dto;

import com.example.guetdemo.annotations.PhoneValidation;
import com.example.guetdemo.annotations.VerificationCodeValidation;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class CodeDto {

    @NotBlank(message = "电话号码不能为空", groups = {PhoneValidation.class,VerificationCodeValidation.class})
    @Pattern(regexp = "1[3456789]{1}\\d{9}$", message = "手机号格式不正确", groups = {PhoneValidation.class,VerificationCodeValidation.class})
    private String phoneNumber;

    @NotBlank(message = "验证码不能为空", groups = VerificationCodeValidation.class)
    private String code;
}

